<template>
  <div class="home-new">
    <HomePanel ref="el" title="人气推荐" sub-title="人气爆款 不容错过">
      <template #right><XtxMore path="/" /></template>
      <transition name="fade">
      <!-- 面板内容 -->
      <ul class="goods-list" v-if="goods.length">
        <li v-for="item in goods" :key="item.id">
          <RouterLink to="/">
            <img :src="item.picture" alt="">
            <p class="name ellipsis">{{ item.title }}</p>
            <p class="price">{{ item.alt }}</p>
          </RouterLink>
        </li>
      </ul>
      <HomeSkeleton v-else></HomeSkeleton>
      </transition>
    </HomePanel>
  </div>
</template>
<script>
import HomePanel from './home-panel'
import XtxMore from '@/components/library/xtx-more.vue'
import HomeSkeleton from './home-skeleton'
import { findHot } from '@/api/home'
import { userLanJiazai } from '@/hooks'
export default {
  name: 'HomeNew',
  components: { HomePanel, XtxMore, HomeSkeleton },
  setup () {
    return userLanJiazai(findHot())
  }
}
</script>
<style scoped lang="less">
.goods-list {
  display: flex;
  justify-content: space-between;
  height: 406px;
  li {
    width: 306px;
    height: 406px;
    background: #f0f9f4;
    .hoverShadow();
    img {
      width: 306px;
      height: 306px;
    }
    p {
      font-size: 22px;
      padding: 12px 30px 0 30px;
      text-align: center;
    }
    .price {
      color: @priceColor;
    }
  }
}
</style>
